import Image from './Image';
import TextEditor from './TextEditor/index.vue';
import LayoutTabs from './Tabs/index.vue';
import UploadImage from './UploadImage/index.vue';
import WebFrame from './WebFrame';
import MySelect from './Select/index.vue';
import TreeSelect from './TreeSelect/index.vue';
import DatePick from './Date/index.vue';
import GridContainer from './gridContainer/index.vue';

// 组件
import {
  BILineBlock,
  BIPieBlock,
  BIBarBlock,
  BITableBlock,
  BISimpleTableBlock,
  BITargetCard,
} from '../widgetCanvas/index';

import { markRaw } from 'vue';

class LayoutItemMap {
  map = {};

  registerItem(key, singleItem) {
    this.map[key] = singleItem;
  }

  registerGroup(groupObj) {
    Object.assign(this.map, groupObj);
  }
}

const layoutItemMap = new LayoutItemMap();

layoutItemMap.registerItem(Image.name, markRaw(Image));
layoutItemMap.registerItem(TextEditor.name, markRaw(TextEditor));
layoutItemMap.registerItem(UploadImage.name, markRaw(UploadImage));
layoutItemMap.registerItem(WebFrame.name, markRaw(WebFrame));
layoutItemMap.registerItem(LayoutTabs.name, markRaw(LayoutTabs));
layoutItemMap.registerItem(MySelect.name, markRaw(MySelect));
layoutItemMap.registerItem(TreeSelect.name, markRaw(TreeSelect));
layoutItemMap.registerItem(DatePick.name, markRaw(DatePick));
layoutItemMap.registerItem(GridContainer.name, markRaw(GridContainer));

layoutItemMap.registerItem(BITableBlock.name, markRaw(BITableBlock));
layoutItemMap.registerItem(BILineBlock.name, markRaw(BILineBlock));
layoutItemMap.registerItem(BIPieBlock.name, markRaw(BIPieBlock));
layoutItemMap.registerItem(BIBarBlock.name, markRaw(BIBarBlock));
layoutItemMap.registerItem(
  BISimpleTableBlock.name,
  markRaw(BISimpleTableBlock),
);
layoutItemMap.registerItem(BITargetCard.name, markRaw(BITargetCard));

export { layoutItemMap };
export {
  TextEditor,
  UploadImage,
  WebFrame,
  LayoutTabs,
  MySelect,
  TreeSelect,
  DatePick,
  GridContainer,

  BITableBlock,
  BILineBlock,
  BIPieBlock,
  BIBarBlock,
  BISimpleTableBlock,
  BITargetCard,
};
